extends Label

var bgm1 = load("res://bgm/ayk110.ogg")

export var txts:PoolStringArray
var char1 = load("res://chars/y02.png")
var char2 = load("res://chars/y09.png")
var bg_room = load("res://bg/074.jpg")
var bg_door = load("res://bg/080.jpg")
var bg_louti = load("res://bg/131.jpg")
var index = -1
var bg_finish = load("res://finish.tscn")

func _ready():
	pass

func _on_Label_gui_input(event):
	if event is InputEventMouseButton:
		if event.pressed:
			index += 1
			self.text = txts[index]
			$AnimationPlayer.play("text")
			if index == 11:
				$char.texture = char1
			if index == 12:
				$bg.texture = bg_louti
			if index > 12:
				$bg.texture = bg_room
			if index == 15:
				$char.texture = char2
			if index == 18:
				$char.texture = char1
			if index == 20:
				$bg.texture = bg_door
				$char.hide()
			if index == 21:
				$bg.texture = bg_door
			if index == 29:
				get_parent().add_child(bg_finish.instance())
			
			if index > 21:
				#$bg.texture=bg_room
				pass
	pass
